<template>
  <div>
    <!-- 标题 -->
    <p class="title">推荐歌单</p>
      <van-row gutter="10">
        <van-col v-for="obj in recommendList" :key="obj.id" span="8"
          ><van-image width="100%" height="7rem" :src="obj.picUrl" />
          <p class="sone_name">{{ obj.name }}</p>
        </van-col>
      </van-row>
    <p class="title">最新音乐</p>
    <songItem
      v-for="obj in newList"
      :key="obj.id"
      :name="obj.name"
      :author="obj.song.artists[0].name"
      :id="obj.id"
    ></songItem>
  </div>
</template>

<script>
import { recommendMusicAPI, newMusicAPI } from "@/api";
import songItem from "./songItem.vue";
export default {
  data() {
    return {
      recommendList: [], //推荐歌单
      newList: [],
    };
  },
  async created() {
    const res = await recommendMusicAPI({ limit: 6 });
    //console.log(res);
    this.recommendList = res.data.result;

    const songRes = await newMusicAPI({ limit: 20 });
    //console.log(songRes);
    this.newList = songRes.data.result;
  },
  components: {
    songItem,
  },
};
</script>

<style scoped lang="less">
.title {
  padding: 1px;
  margin: 0 0 1px 0;
  background-color: #eee;
  color: #333;
  font-size: 15px;
}
.song_name {
  font-size: 0.346667rem;
  margin-bottom: 0.266667rem;
  word-break: break-all;
  text-overflow: ellipsis;
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
.custom-title {
  margin-right: 4px;
  vertical-align: middle;
}

.search-icon {
  font-size: 16px;
  line-height: inherit;
  vertical-align: middle;
}
</style>